<?php
/* [DoYouHaoBaby!] (C)Dianniu From 2010.
   this($)*/

!defined('DYHB_PATH') && exit;

class TemplateGtkGladeWidgetCompiler_GtkMenuItem extends TemplateGtkGladeWidgetCompilerBase{

	protected function compileCreateWidget_(TemplateGtkGladeWidget $oObject){
		$sWidgetClass=$oObject->getWidgetClass();
		$sVariableName='$'.TemplateGtkGlade::getWidgetVariableName($oObject);
		$sLabel=$oObject->getProperty('label');
		$sCompiled="\t\t{$sVariableName}=new {$sWidgetClass}('{$sLabel}');";
		if(($sValue=TemplateGtkGladeObj::nodeTextToValue($oObject->getProperty('use_underline')))===null){$sValue='true';}// 使用下划线
		$sCompiled.="\t\t{$sVariableName}->child->set_use_underline({$sValue});";
		return $sCompiled;
	}

	protected function compileChildWidgetPacking_(TemplateGtkGladeWidget $oParentWidget,TemplateGtkGladeWidget $oChildWidget, TemplateGtkGladeWidgetPacking $oPacking){
		$sParentVariableName='$'.TemplateGtkGlade::getWidgetVariableName($oParentWidget);// 父/子 窗体变量名
		$sChildWidgetVariableName='$'.TemplateGtkGlade::getWidgetVariableName($oChildWidget);
		$sChildWidgetName=$oChildWidget->getWidgetId();// 子窗体名
		$sCompiled="\t\t{$sChildWidgetVariableName}=self::getWidget('{$sChildWidgetName}',\$arrObjectForSignal);";
		$sCompiled.="\t\t{$sParentVariableName}->set_submenu({$sChildWidgetVariableName});";
		return $sCompiled;
	}

	static public function regToProcessorManager(ITemplateObjProcessorManager $oManager){
		$oManager->regProcessor(str_replace('TemplateGtkGladeWidgetCompiler_','',__CLASS__),__CLASS__);
	}

}
